/**
 * @overview 相机控制
 * @author dengqiang
 * @description 引用Cesium 原生Camera类
 * @update  2022.03.29
 */
class GCamera {
  constructor() {}

  /**
   * @description 漫游定位
   * @param option {pos：{lng:118, lat:23, height:1000}}
   */
  flyTo(option) {
    //默认视角垂直向下
    const orientation = {
      heading: Cesium.Math.toRadians(0),
      pitch: Cesium.Math.toRadians(-90),
      roll: Cesium.Math.toRadians(0),
    }
    window.map3DControl.viewer.camera.flyTo({
      destination: Cesium.Cartesian3.fromDegrees(option.pos.lng, option.pos.lat, option.pos.height), //必填，目标点坐标
      duration: option.flyTime || 3, //非必填，漫游持续的时间
      // complete: option.callBack || function () { },//非必填，漫游结束时的回调函数
      orientation: option.orientation || orientation,
    })
  }
}

export default GCamera
